home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Database How-To
/
Visual Basic 4 Database - How-to (The Waite Group)(1995).iso
/
select9.fr_
/
select9.fr
Wrap
Text File
|
1995-07-04
|
6KB
|
203 lines
VERSION 4.00
Begin VB.Form Form1
BackColor = &H00C0C0C0&
Caption = "QBE SELECTer"
ClientHeight = 3195
ClientLeft = 1560
ClientTop = 1575
ClientWidth = 6030
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 3600
Left = 1500
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 6030
Top = 1230
Width = 6150
Begin VB.TextBox txtTitle
Height = 315
Left = 1800
TabIndex = 8
Top = 780
Width = 3495
End
Begin VB.TextBox txtAuthor
Height = 315
Left = 1800
TabIndex = 7
Top = 1200
Width = 3495
End
Begin VB.TextBox txtPublished
Alignment = 2 'Center
Height = 315
Left = 1800
TabIndex = 6
Top = 1620
Width = 1095
End
Begin VB.TextBox txtPublisher
Height = 315
Left = 1800
TabIndex = 5
Top = 360
Width = 3495
End
Begin VB.CommandButton cmdMove
Caption = ">|"
Height = 435
Index = 3
Left = 2400
TabIndex = 4
Top = 2220
Width = 555
End
Begin VB.CommandButton cmdMove
Caption = ">"
Height = 435
Index = 2
Left = 1860
TabIndex = 3
Top = 2220
Width = 555
End
Begin VB.CommandButton cmdMove
Caption = "<"
Height = 435
Index = 1
Left = 1320
TabIndex = 2
Top = 2220
Width = 555
End
Begin VB.CommandButton cmdMove
Caption = "|<"
Height = 435
Index = 0
Left = 780
TabIndex = 1
Top = 2220
Width = 555
End
Begin VB.CommandButton cmdClose
Cancel = -1 'True
Caption = "Close"
Default = -1 'True
Height = 435
Left = 4020
TabIndex = 0
Top = 2220
Width = 1215
End
Begin VB.Label Label4
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Title:"
Height = 195
Left = 660
TabIndex = 12
Top = 840
Width = 450
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Author:"
Height = 195
Left = 660
TabIndex = 11
Top = 1260
Width = 630
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Published:"
Height = 195
Left = 660
TabIndex = 10
Top = 1680
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Publisher:"
Height = 195
Left = 660
TabIndex = 9
Top = 420
Width = 855
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Private db As DATABASE
Private rs As Recordset
Private Sub cmdClose_Click()
End
End Sub
Private Sub cmdMove_Click(Index As Integer)
Const MOVE_FIRST = 0
Const MOVE_PREVIOUS = 1
Const MOVE_NEXT = 2
Const MOVE_LAST = 3
Select Case Index
Case MOVE_FIRST
rs.MoveFirst
Case MOVE_LAST
rs.MoveLast
Case MOVE_PREVIOUS
rs.MovePrevious
If rs.BOF Then rs.MoveFirst
Case MOVE_NEXT
rs.MoveNext
If rs.EOF Then rs.MoveLast
End Select
DisplayRecord
End Sub
Private Sub Form_Load()
Dim pastedSQL As String
Dim dbName As String
' Get the database name and open the database.
dbName = BiblioPath() ' BiblioPath is a function in READINI.BAS
Set db = DBEngine.Workspaces(0).OpenDatabase(dbName)
pastedSQL = "SELECT DISTINCTROW Publishers.Name, Titles.Title, Authors.Author, Titles.[Year Published]"
pastedSQL = pastedSQL & " FROM Authors INNER JOIN ((Publishers INNER JOIN Titles ON Publishers.PubID = Titles.PubID) INNER JOIN [Title Author] ON Titles.ISBN = [Title Author].ISBN) ON Authors.Au_ID = [Title Author].Au_ID"
pastedSQL = pastedSQL & " WHERE ((Publishers.City = 'new york'))"
pastedSQL = pastedSQL & " ORDER BY Publishers.Name;"
Set rs = db.OpenRecordset(pastedSQL, dbOpenSnapshot)
If rs.RecordCount > 0 Then
rs.MoveFirst
DisplayRecord
End If
End Sub
Sub DisplayRecord()
txtPublisher = rs![Name]
txtTitle = rs![Title]
txtAuthor = rs![Author]
txtPublished = rs![Year Published]
End Sub